class: center, middle, inverse, title-slide .title[ # FIN7030: Times Series Financial Econometrics 1 ] .subtitle[ ## Rethinking Econometrics ] .author[ ### Barry Quinn ] .author[ ### Applied Statistician PhD CStat ] .date[ ### 2023-01-29 ] --- layout: true <div class="my-footer"> <span> Barry Quinn CStat </span> </div> --- layout: true <div class="my-footer"><span>quinference.com</span></div> --- class: ## Contact details .pull-left[ .large[ - **Barry Quinn** - b.quinn@qub.ac.uk - via [Rethinking Economemtrics Slack Channel ](https://join.slack.com/t/rethinkingeco-3ss9716/shared_invite/zt-12nfdfr7o-XAy2Ef1knAKXgUNo2kWw3w)) - Chartered Statistician (Royal Statistical Society) - 8 years industry + 10 years academia] ] .pull-right[ .large[ - **Veronica Zhang** - yzhang107@qub.ac.uk - Studying for a PhD in capital regulation in chinese banking. ] ] --- class: middleowa # Learning outcomes - Begin to understand econometrics as a science of uncertainty and variation. - Introduction to the ethical application of statistics using dynamic reporting and literate programming. - Exhibit intellectual humility and discipline in data analytics. - Understand the iterative process of real-world data analysis. - Understand how to use statistical techniques to calibrate answers to many problems posed in Finance. - Understand how to source, prepared and encode financial time series data. - Obtain analytical skills to identify patterns in data. - Understand how to robustly infer real-world effects from statistical analysis. - Understand how to encode analytical questions using statistical software. - Work independently or in groups towards an empirical goal. --- class: middle # Professional skills - Modern data science [`tidy`](https://r4ds.had.co.nz/tidy-data.html) data principles. - Literate programming principles [Donald Knuth](https://www-cs-faculty.stanford.edu/~knuth/taocp.html). - Open science analytics using cloud computing .glowline[Q-RaP]-[https://sso.rstudio.cloud/q-rap](https://www-cs-faculty.stanford.edu/~knuth/taocp.html) - Responsible research principles to produce sensible statistical inference. - Principles of appropriate data visualisation. - The ability to work independently to glean meaning from noisy financial data. - Advanced professionalism through improved independent learning/research techniques. --- class:middle # Rethinking econometric principles .salt[ - Gain insight into the limitations of statistical models - Begin to use statistical models responsibly, ethically, and professionally. - To have enough *statistical knowledge* to be comfortable with *knowing that you don't know*. ] > .large[Building up your empirical stamina] --- class: middle ## Teaching and learning philosopy .salt[ - Instil:] * .saltinline[Intellectual discipline] - `Think critically and form your own opinions` * .saltinline[Intellectual humility] - `Enough confidence to be comfortable in your own confusion` 3. .saltinline[Good citizenship] - `Acting ethically, altruistically, responsibly and professionally` 4. .saltinline[Employability] - `Develop students into employable graduates` ] --- class: middle ## Teaching and learning approach - Lectures will combine concepts and financial application with live-coding. - Come prepared and bring your laptop or device with web browser. - Interactive tutorials on QMS Remote Analytics Platform (Q-RaP). ## Feedback - Student *feedback* is important to me and I will provide this in a *professional* manner *conditional* on students behaving in a *professional and courteous* manner. - Each week there will be an anonymous poll where you can give feedback. - I am a NICE person when students act in a professional and courteous. - Otherwise I can be a fastidious scold. >Read my communiction policy link --- class: middle # What is Q-RaP? -- ### Qms-Remote analytics Platform -- >**Motivation**: - A crisis of confidence exists in science; finance included! - My goal for Q-RaP is to educate students on the principles of [Open Science](https://www.rrbm.network) using open source analytics. - Allow students to do something interest with data within the first 10 minutes of the first class. -- - .acidinline[It consists of two parts] .pull-left[ **Advanced Teaching** - High-Performance Cloud Computing - Hosted in Azure - Managed by QMS DevOps Team - For Advanced Analytics at PGT and PGR level - Request form access only ] .pull-right[ **Foundational Teaching** - Posit Cloud (200+ students concurrently) - SSO authentication using Sibboleith - Works out of the box ] --- class: middle .pull-left[ ### you used to have this <img src="data:image/png;base64,#img/jonathan-borba-PZBjJ12Xv2s-unsplash.jpg" width="70%" /> ] -- .pull-right[ ### and now you have this <img src="data:image/png;base64,#img/sincerely-media-o5Key-1HzaY-unsplash.jpg" width="80%" /> ] .footnote[ .tiny[Photos by Jonathan Borba and Sincerely Media on Unsplash.] ] --- class: middle ## What is Posit Cloud? <br> .pull-left-narrow[ <img src="data:image/png;base64,#img/cloud.png" width="264" /> ] .pull-right-wide[ .large[[**Posit Cloud**](https://Posit.cloud/) created to make it easy for professionals, hobbyists, trainers, teachers, and students to do, share, teach, and learn data science using R.] ] --- class: middle .center[ <img src="data:image/png;base64,#img/rstudio-ide.png" width="80%" /> ] --- class: middle .center[ <img src="data:image/png;base64,#img/rstudio-cloud.png" width="80%" /> ] --- --- class: middle ## First look .large[[https://sso.posit.cloud/q-rap](https://sso.posit.cloud/q-rap)] <img src="data:image/png;base64,#img/q-rap-landing-1.png" width="80%" style="display: block; margin: auto;" /> --- class: middle .your-turn[ #### 👩💻 Students: - login to Q-RaP using your QUB credentials - Create a new project and give it a name - Install a package of your choice - Create a template R Markdown document in the project - Change the access level of the project so others can see it as well - Copy the project URL and share it with a friend in class ]
−
+
05
:
00
--- class: middle ## Course overview - [Read the canvas home] carefully .large[[Canvas home](https://canvas.qub.ac.uk/courses/11736/pages/please-read-carefully)] ## Active learning and the 15 minute rule  <!-- <iframe width="300" --> <!-- height="200" --> <!-- title="Batman's growth mindset" --> <!-- src="https://youtu.be/ZS8QHRtzcPg"> --> <!-- </iframe> --> - We will use the **15 minute** rule in this class. - If you encounter problems, spend 15 minutes troubleshooting on your own. - Make use of Google and StackOverflow to resolve the error - If your problem is not resolved after 15 minutes. - Use my Slack channel to **[ask for help]**. join [here](https://join.slack.com/t/rethinkingeco-3ss9716/shared_invite/zt-12nfdfr7o-XAy2Ef1knAKXgUNo2kWw3w) --- class: middle .acid[ # Plagiarism * I am trying to balance two competing perspectives: 1. Collaboration is good 2. Collaboration is cheating * In-class collaboration is good **to a point**. * You are always expected to write and submit your **own work**. * Asking for help is ok (after 15 minute rule), * Blindly copy from your peers (or published work) is not. ] --- class: middle ## Important Dates * Project Deadline 31st March * Computer based exam (after easter break) --- class: middle .huge-text[Rethinking econometrics] --- class:middle ## Rethinking econometrics .salt[ - Statistics is the science of uncertainty and variation. - Time series financial econometrics is the application of statistics to dynamic problems in finance. - Ethically, statistical models should be thought of as engineered robots. ] --- class: middle ## Rethinking econometrics .large[ - Statistic courses and books, including this one, resemble horoscopes - In order to remain plausibly correct, they must remain tremendously vague - There are strong incentives for statisticians to exaggerate the power of their advice. - Scientific discovery is not an additive process and statistical inference is only as critical as every other part of research. ] --- class: middle ## Rethinking econometrics .large[ >*Statistics is no closer to mathematics than cooking is to chemistry*- [Terry Speed 1986](http://iase-web.org/documents/papers/icots2/Speed.pdf) - In statistics context is king, and in econometrics we have to look to the context of the research questions before applying techniques. - Blind application of techniques without understanding is dangerous and unethical. ] --- class: middle ## Rethinking econometric models - Modestly, models can be thought of as **engineer statistical robots**. - Engineered via a set of (usually unrealistic) assumptions. - Animated by "truth". - Hopefully powerful. - Blind to the creator's intent. - Easy to misuse. - Not even false: They are as false as a hammer! --- class: middle ## "Scaffolding" by Seamus Heaney, 1939–2013 .blockquote[ Are careful to test out the scaffolding; Masons, when they start upon a building, Are careful to test out the scaffolding; Make sure that planks won’t slip at busy points, Secure all ladders, tighten bolted joints. And yet all this comes down when the job’s done Showing off walls of sure and solid stone. So if, my dear, there sometimes seem to be Old bridges breaking between you and me Never fear. We may let the scaffolds fall Confident that we have built our wall. ] --- class: middle ## Ethical econometrics .large[ - Ethical econometrics is having enough confidence and knowledge in statistics to understand its limitations. - This course provides an *ethical* scaffold, to construct *statistical* models. - This course will force you to perform step-by-step calculations that are usually automated. ] --- class: middle ## Ethical econometrics .large[ - The reason for all the algorithmic fuss is to ensure that you understand enough of the details to make sensible choices and interpretations in your own modeling work. - At first we will take things slow but move on to use more automation. .fat[Put up your wall, and then let the scaffolding fall.] ] --- class: middle ## Rethinking: Staring into the abyss. * Econometric models can be complicated monsters. * But as models become more monstrous, so too does the code needed to compute predictions and display them. **With power comes hardship.** * It’s better to see the guts of the machine than to live in awe or fear of it. * Software can be and often is written to hide all the monstrosity from us. * But this doesn’t make it go away. * Instead, it just makes the models forever mysterious. * For some users, mystery translates into awe. * For others, it translates into skepticism. * Neither condition is necessary, as long as we’re willing to learn the structure of the models we are using. * And if you aren’t willing to learn the structure of the models, then don’t do your own statistics. * Instead, collaborate with or hire a statistician. --- class: middle ## Model checking * Every model is a merger of **sense** and **nonsense** * When we understand a model, we find its sense and control its nonsense. * Complex models should not be view with awe but with **informed** suspicion. * Intellectual discipline provides the base to be *informed* * comes with breaking down the model into its components and checking its validity. --- class: middle ## Ethical econometrics using Open Science .large[ - Using Quarto, Git, Github. - An industry standard for modern statistical analysis. - Creates reusable, transparent, and interpretable code. - Ethical econometrics is about creating reproducible research. - The goal of this course is to teach basic computational skills for sensible FTS analysis. - You will not become an expert programmer! ] --- class: middle .huge-text[Uncertainty in econometrics] --- class: middle ## Uncertainty in econometrics .large[ - Uncertainty is the overarching tenent of statistics. - Uncertainty is applied using a probability theory. - Probability theory is just a calculus for counting; and thus can be used to represent plausibility of things like model parameters. - Unlike most other branches of mathematics, statistics has no unifying theory of probability. - The two popular approaches to probability are bayesian and frequentist. ] --- class: middle ## Bayesian inference - The term *bayesian* has many uses in statistics but mainly as a way of interpreting probability. - In modest terms, Bayesian inference is no more than counting the number of ways things can happen, according to our assumptions. - More plausible things can happen more ways. ## Bayesian inference - Once assumptions are defined, Bayesian inference forces a purely logical way of processing that information to produce inference. - Count all the ways data can happen, according to assumptions - Assumptions with more ways that are consistent with the data are more plausible. - In this way all parts of the model building process can exhibit uncertainty. --- class: middle ## Frequentist inference - Frequentist probability is a special case of Bayesian probability. - It defines probability by connection to countable events and their frequencies in very large samples. - The leads to frequentist uncertainty being premised on imaginery resampling of data. - A fantasy of repeating the measurement many many times, to collect a list of values which will have some pattern to it. ## Frequentist inference - This means that parameters and models cannot have probability distributions, only measurement (data). - The distribution of these measurement is called a **SAMPLING DISTRIBUTION**. - In practice resampling is never done, and in general it doesn't even make sense. --- class: middle ## Bayesian Versus frequentist - The frequentist philosophical approach (sometime referred to as *classical*) is convention in econometrics. - This is probably more to do with scientists' desire for results via *bright line* hypothesis testing than rigorous analysis. - It involves postulating a theory then setting up a model and collecting data to test this model. - Based on the results of the model, the theory is supported or refuted. - A common approach is null hypothesis significance testing (NHST) using p-values. --- class: middle ## Bayesian versus frequentist - In Bayesian inference the theory and model are developed together. - Parameters, models and measurement have probability distributions. - An assessment of existing knowledge is formulated into *prior* probabilities. - Data are combined with *priors* to form and model in a strictly logical way to produce updated probabilities known as *posteriors*. - Bayesian inference is computationally intensive, which used to be a barrier to application. --- class: middle ## Bayesian Versus frequentist - Some *classical* researcher find Bayesian approach controversial. - Strong priors can be hard to dominate with data, so researchers can pick whatever results they want! - In modern statistics this controversy is largely redundant. --- class: middle ## Rethinking econometrics - In ethical econometrics, each approach can arguable have fantastical assumptions: 1. What does the data look like under resampling? 2. Using probability to describe prior beliefs or knowledge. - Rather like robots, statistical models are neither true or false, rather constructs engineered for some purpose. - Importantly, context is everything in statistics, and a *ethical econometrician* should use all avaliable tools in their statistical engineering arsenal. --- class: middle .huge-text[Applying time series financial econometrics] --- class: middle ## Rethinking econometrics: #### to explain, predict or describe .large[ - It is **wrongly** assumed that high explanatory = high predictive power. - Explanatory models apply statistics to data to test **casual** hypothesis of theoretical constructs. - Prediction models apply statistics or data mining algorithms to data to predict future observations. - The type of model uncertainty is different for each choice. - Explaining minimises *bias*, while prediction minimises *bias + variance* occasionally sacrificing theoretical accuracy for empirical precision. ] --- class: middle ## Building a model * How to use probability to do typical statistical modeling? 1. Design the model (data story) * Formulated using theory from previous studies 2. Condition on the data (update or estimate model) 3. Evaluate the model (critique) * **And Repeat Until Satisified** --- class: middle ## Reading finance papers (the context) - You data story comes from reading research papers #### Research project tips - What is the puzzle the paper is trying to solve? - How do they solve it? - Does it develop a new model? - Is it an existing technique with a new application? - Is it a data mining excercise? - Is the data of *good quality* ? Reliable, sample size etc. --- class: middle ## Reading finance papers ### Research project tips - Have model assumptions been validly checked and critiqued? - Are results interpreted sensibly or exaggerated? - Do results actually address the questions posed? - Have conclusions been drawn appropriate or overstated? --- class: middle ## Model comparison .pull-left-1.large[Instead of falsifying a null model, compare meaningful models.] .pull-right-2[ .large[Basic problems] - Overfitting or Data Snooping - Causal inference - Ockham's razor is silly - Information theory is less silly - AIC, cross-validation - Must distinguish prediction from inference ] --- class: middle ## Applying financial time series econometrics - Financial time series econometrics is concerned with theory and practice of asset valuation over time - It has similarity to other time series analysis but has some added uncertainty. - FTS analysis must deal with the ever-changing business and economic enviroment and the fact that volatility is not directly observed. --- class: middle ## Applying financial time series econometrics **Describe** 1. Estimating parameters of well-defined probability models that describe the behaviour of financial time series. **Explain** 2. Testing hypotheses on how financial markets generate the series of interest. **Predict** 3. Forecast future realisations of the financial time series. --- class: center # .glow[Questions?] Slides created via the R packages: [**xaringan**](https://github.com/yihui/xaringan)<br> [gadenbuie/xaringanthemer](https://github.com/gadenbuie/xaringanthemer) The chakra comes from [remark.js](https://remarkjs.com), [**knitr**](http://yihui.name/knitr), and [R Quarto](https://quarto.org).